package com.ninetaildemonfox.zdl.socialproject.mvp.ui.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.ninetaildemonfox.zdl.socialproject.base.BaseActivity;
import com.ninetaildemonfox.zdl.socialproject.R;
import com.ninetaildemonfox.zdl.socialproject.mvp.contract.AforInvitationContract;
import com.ninetaildemonfox.zdl.socialproject.mvp.presenter.AforInvitationPresenter;

import java.util.Map;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author NineTailDemonFox
 * @date 2019/7/17 16:32
 * 功能描述： 申请邀请码
 * 联系方式：1037438704@qq.com
 */
public class AforInvitationActivity extends BaseActivity implements AforInvitationContract {

    @BindView(R.id.image_left_finish)
    ImageView imageleftFinish;
    @BindView(R.id.text_center)
    TextView textCenter;
    @BindView(R.id.text_right)
    TextView textRight;
    @BindView(R.id.text_welcome)
    TextView textWelcome;
    @BindView(R.id.edit_city)
    EditText editCity;
    @BindView(R.id.edit_where)
    EditText editWhere;
    @BindView(R.id.edit_phone)
    EditText editPhone;
    @BindView(R.id.edit_recommender)
    EditText editRecommender;
    private AforInvitationPresenter aforInvitation;


    @Override
    protected int getLayoutResource() {
        return R.layout.activity_afor_invitation;
    }

    @Override
    protected void onInitialization(Bundle bundle) {
        imageleftFinish.setVisibility(View.VISIBLE);
        textCenter.setText("申请邀请码");
        aforInvitation = new AforInvitationPresenter(this, me);
    }

    @OnClick({R.id.image_left_finish, R.id.text_welcome})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.image_left_finish:
                finish();
                break;
            case R.id.text_welcome:
                aforInvitation.getAddApply(token
                        , editCity.getText().toString().trim()
                        , editWhere.getText().toString().trim()
                        , editPhone.getText().toString().trim()
                        , editRecommender.getText().toString().trim());
                finish();
                break;
            default:
        }
    }

    @Override
    public void Success(Map<String, String> map) {

    }

    @Override
    public void Failed(String msg) {

    }

    @Override
    public void showLoading() {

    }
}
